package marchsoft.utils;
/**
 * @title LocalDateTimeSerializerSelf
 * @description
 * @author Lenovo
 * @version 1.0
 * @create 2024-09-05 14:51
 */

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 *@title LocalDateTimeSerializerSelf
 *@description
 *@author Lenovo
 *@version 1.0
 *@create 2024-09-05 14:51
 */
public class LocalDateTimeSerializerSelf extends JsonSerializer<LocalDateTime> {
    public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        gen.writeString(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(value));
    }
}
